<?php

class ME_Caching_Memcache extends ME_Caching_Abstraction
{
	protected static $servers   = array(
		'110.115.184.100:11211'
	);
	
	protected static $mem;

	protected static function init()
	{
		if (empty(self::$mem))
		{
			self::$mem = new Memcache;
			foreach (self::$servers as $val)
			{
				$exp = explode(':', $val);
				self::$mem->addServer($exp[0], $exp[1]);
			}
		}
	}
	public static function flush()
	{
		self::init();

		return self::$mem->flush();
	}
	public static function get($key)
	{
		self::init();

		return self::$mem->get($key);
	}
	public static function delete($key)
	{
		self::init();

		return self::$mem->delete($key);
	}
	public static function set($key = '', $var = '', $expire = 3600)
	{
		self::init();

		return self::$mem->set($key, $var, 0, $expire);
	}
	public static function add($key = '', $var = '', $expire = 3600)
	{
		self::init();

		return self::$mem->add($key, $var, 0, $expire);
	}
}

?>
